version: "4.12"

services:
  db:
    container_name: scrapper_database
    image: postgres
    environment:
      POSTGRES_USER: $POSTGRES_USER
      POSTGRES_PASSWORD: $POSTGRES_PASSWORD
    restart: unless-stopped
    command: -p $POSTGRES_PORT
    network_mode: bridge
    ports:
      - $POSTGRES_PORT:$POSTGRES_PORT
    extra_hosts:
      - "host.docker.internal:host-gateway"

  scrapper:
    container_name: scrapper
    build:
      context: .
    restart: unless-stopped
    environment:
      - POSTGRES_USER=${POSTGRES_USER}
      - POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
      - POSTGRES_PORT=${POSTGRES_PORT}
      - API_LINK_URL=${API_LINK_URL}
      - API_LINK_PATH=${API_LINK_PATH}
    depends_on:
      - db
